Display Call To Action bar on page load [migrated]

Posted by dasickle on Pro Webmasters See other posts from Pro Webmasters or by dasickle
Published on 2014-08-19T20:37:58Z Indexed on 2014/08/19 22:34 UTC
Read the original article Hit count: 327

I am using the following code to load the bar on click but I can't figure our how to load it on page load automatically.

<script>
var autohide;
$('body').prepend('<div id="bn-bar"><b>DON\'T MISS OUT!</b> Only 9 seats remain for the Google Tag Manager training on May 22!    <a href="#">Book Your Seat Today!</a><div id="hider"> </div></div>');
$(document).ready(function(){
$("#hider").click(function(){
  $("#bn-bar").animate({
    top: "-50"
  }, "fast","linear", function(){});
})
$("#bn-bar").mouseover(function(){clearTimeout(autohide);});
setTimeout(function(){$("#bn-bar").animate({top: "0"}, "slow","linear", function(){});},2500);
autohide = setTimeout(function(){$("#bn-bar").animate({top: "-30"}, "fast","linear", function(){});},10000);
})
</script>

Basically I am trying to load a the message when user enters my website and I will be inserting it via Google Tag Manager. Below is a page where I found the code:

Creative Tag Manager – Ads, Promotions, and Visitor Messaging -Lunametrics

© Pro Webmasters or respective owner

Related posts about JavaScript

Related posts about jQuery